package com.wontube.smr.web.controller.i18n;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.wontube.client.modle.vo.PagenateInfo;
import com.wontube.client.remote.Remoting;
import com.wontube.smr.web.client.admin.IAdminHandler;

/**
 * tool 控制器
 * 
 * @author hewc@wondershare.cn
 * 
 */
@Controller
@RequestMapping(value = "/world/tools", method = RequestMethod.GET)
public class I18nToolController {
	@RequestMapping("")
	public void f6(HttpServletRequest request, 
			HttpServletResponse response) throws IOException{
		response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
		response.sendRedirect(request.getContextPath() + "/world/tools/");		
	}
	
	@RequestMapping("/")
	public ModelAndView index() {
		ModelAndView mv = new ModelAndView();
		Remoting<IAdminHandler> remoting = new Remoting<IAdminHandler>();
		IAdminHandler handler = remoting.createService(IAdminHandler.class);
		mv.addObject("websiteItems", handler.selectTool("Website", new PagenateInfo(1, 3)));
		mv.addObject("pcItems", handler.selectTool("Pc", new PagenateInfo(1, 4)));
		mv.addObject("mobileItems", handler.selectTool("Mobile", new PagenateInfo(1, 3)));
		mv.setViewName("/i18n/tools/tool_index");
		return mv;
	}

}
